angular.module('mamApp').factory('SystemManager', ['$http', 'api', 'paramsManager', function ($http, api, paramsManager) {
    var SystemManager = {

        /**
         * 修改密码
         * @param params
         * @returns
         */

        resetPassword: function (params) {
            return $http.put(api+'/admin/info/password', params).then(function (result) {
                return result;
            });
        },
        /**
         * 管理员列表
         * @param params
         * @returns
         */
        adminUserList: function (params,query) {
            return $http.get(api + '/admin/manager/adminList/'+paramsManager.params(params)+paramsManager.query(query) ).then(function (result) {
                return result;
            });
        },
        /**
         * 管理员删除
         * @param params
         * @returns
         */
        adminUserDelete: function (adminId) {
            return $http.delete(api + '/admin/manager/admin/'+adminId).then(function (result) {
                return result;
            });
        }, 
        /**
         * 管理员详情
         * @param params
         * @returns
         */
        adminUserDetail: function (adminId) {
            return $http.get(api + '/admin/manager/admin/'+adminId).then(function (result) {
                return result;
            });
        },
        /**
         * 管理员信息修改
         * @param params
         * @returns
         */
        adminUserEdit: function (params) {
            return $http.put(api + '/admin/manager/admin',params).then(function (result) {
                return result;
            });
        },
        /**
         * 管理员新增
         * @param params
         * @returns
         */
        adminUserAdd: function (params) {
            return $http.post(api + '/admin/manager/admin',params).then(function (result) {
                return result;
            });
        },
        /**
         * 日志
         * @param params
         * @returns
         */
        logList: function (params,query) {
            return $http.get(api + '/admin/logs/logList/'+paramsManager.params(params)+paramsManager.query(query) ).then(function (result) {
                return result;
            });
        },
        /**
         * 所有部门的列表
         * @param params
         * @returns
         */
        departmentsList: function (query) {
            return $http.get(api + '/admin/info/departments'+paramsManager.query(query) ).then(function (result) {
                return result;
            });
        },

    };

    return SystemManager;
}]);

